CXX           = g++
DEFINES       = -DQT_SCRIPT_LIB \
                -DQT_GUI_LIB \
                -DQT_NETWORK_LIB \
                -DQT_CORE_LIB \
                -DQT_SHARED
CXXFLAGS      = -pipe -g -D_REENTRANT -Wall -W $(DEFINES)
INCPATH       = -I/usr/lib64/qt4/include/QtCore \
                -I/usr/lib64/qt4/include/QtNetwork \
                -I/usr/lib64/qt4/include/QtGui \
                -I/usr/lib64/qt4/include/QtScript \
                -I/usr/lib64/qt4/include \
                -Iinclude \
                -I.
LINK          = g++
LFLAGS        = 
LIBS          = -L/usr/lib -lQtScript -lQtGui -lQtNetwork -lQtCore -lpthread 

OBJECTS_DIR   = obj/
SOURCES_DIR   = src/
INCLUDE_DIR   = include/
SOURCES       = src/main.cpp \
		src/server.cpp src/moc_server.cpp
OBJECTS       = obj/main.o \
		obj/server.o obj/moc_server.o

TARGET        = cuteserver
DESTDIR       = bin/
TARGET        = bin/cuteserver

all: $(TARGET)

$(TARGET): $(OBJECTS)
	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS)	

$(OBJECTS_DIR)%.o: $(SOURCES_DIR)%.cpp
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"

$(SOURCES_DIR)moc_%.cpp: $(INCLUDE_DIR)%.h
	moc $(DEFINES) $(INCPATH) "$<" -o "$@"

clean:
	rm -f $(OBJECTS_DIR)*
